← Back
Editing: set-firewall.js
import{_ as e}from"./index93.js?v=1765440387";import{c as a,t as s,r as l,q as t,v as r,e as o,A as n,y as i,B as c,x as d,D as p,am as m}from"./base-lib.js?v=1765440387";import{_ as b}from"./index97.js?v=1765440387";import{fj as u,o as f,K as h}from"./utils-lib.js?v=1765440387";import{s as x}from"./firewall.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";const _={class:"p-[2rem]"},j={class:"flex items-center gap-4 mb-2"},v=a({__name:"set-firewall",props:{compData:{default:()=>({fireStatus:!1,callback:()=>{}})}},setup(a,{expose:v}){const g=a,{compData:w}=s(g),P=l([{port:"21",enabled:!0},{port:"SSH",enabled:!0,description:"SSH端口(默认:22)"},{port:"80",enabled:!0},{port:"443",enabled:!0},{port:"39000-40000",enabled:!0},{port:"PanelPort",enabled:!0,description:"面板端口"}]),y=e=>{e?P.value.forEach(e=>{e.enabled=!0}):P.value.forEach(e=>{e.enabled=!e.enabled}),k()},{BtTable:S,refresh:k}=u({request:async()=>({data:P.value,total:P.value.length}),columns:[{label:"端口",prop:"port",render:e=>o("span",{class:"text-[#999]"},[e.description||e.port])},{label:"放行",width:80,render:e=>o(m,{size:"small",modelValue:e.enabled,onChange:a=>{e.enabled=a}},null)}]});return v({onConfirm:async()=>{try{const{disabledPorts:e,enabledPorts:a}={enabledPorts:P.value.filter(e=>e.enabled).map(e=>e.port).join(","),disabledPorts:P.value.filter(e=>!e.enabled).map(e=>e.port).join(",")},s=e;return await f({icon:"question-filled",title:"启用系统防火墙",content:"启用系统防火墙,将放行以下【".concat(a,"】端口,是否继续操作?")}),await h({loading:"正在启用系统防火墙,请稍后...",message:!0,request:x({status:1,ports:s}),success:()=>{w.value.callback()}}),!0}catch(e){return!1}}}),(a,s)=>{const l=b,m=p,u=e;return t(),r("div",_,[o(l,{type:"warning",description:"开启系统防火墙会放行以下端口配置,如需调整,请手动关闭相应端口。","show-icon":"",closable:!1,class:"mb-[1rem]"}),o(u,null,{header:n(()=>[i("div",j,[o(m,{size:"small",onClick:s[0]||(s[0]=e=>y(!0))},{default:n(()=>[...s[2]||(s[2]=[c("全选",-1)])]),_:1}),o(m,{size:"small",onClick:s[1]||(s[1]=e=>y(!1))},{default:n(()=>[...s[3]||(s[3]=[c("反选",-1)])]),_:1})])]),content:n(()=>[o(d(S),{"max-height":350})]),_:1}),s[4]||(s[4]=i("ul",{class:"mt-20px leading-8 text-[1.2rem] list-disc ml-24px"},[i("li",null,"此操作将重载防火墙,未持久化的 iptables 规则会清空,请先备份保存!")],-1))])}}});export{v as default};
Save File
Cancel